package com.tarena.csmall.test.spring.condition;

import com.tarena.csmall.test.spring.bean.Bean05;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.Jedis;

@Configuration
//当容器环境存在指定的类时,条件才满足
//满足条件配置类加载,不满足,则不加在配置
//@ConditionalOnClass(value = {Jedis.class})
@ConditionalOnMissingClass(value={"redis.clients.jedis.Jedis"})
public class ConditionConfig01 {
    public ConditionConfig01() {
        System.out.println("容器加载了ConditionConfig01对象");
    }
    @Bean
    public Bean05 bean05(){
        return new Bean05();
    }
}
